<template>
    <van-cell-group>
        <van-nav-bar title="修改密码" left-text="返回" left-arrow @click-left="$router.back()"  >
            <van-button type="info" slot="right" size="small" @click="updatePassword">提交</van-button>
        </van-nav-bar>
        <van-field v-model="oldPassword"
                clearable
                label="原密码"

                placeholder="请输入原密码"
        />

        <van-field
                v-model="newPassword"
                type="password"
                label="密码"
                placeholder="请输入新密码"
        />
        <van-field
                v-model="newPassword2"
                type="password"
                label="重复新密码"
                placeholder="请再次输入新密码"
        />
    </van-cell-group>
</template>

<script>
    import {Toast} from "vant";
    import ltxService from '../services/LtxService'
    export default {
        data(){
            return{
                oldPassword: "",
                newPassword: "",
                newPassword2:""
            }
        },
        name: "UpdatePassword",
        methods:{
            updatePassword()
            {
                if(this.newPassword!=this.newPassword2)Toast("两次输入的密码不一致")
                else{
                    ltxService.updatePassword(this.oldPassword,this.newPassword).then(resp=>{
                        Toast(resp.data.msg)
                    })
                }
            }
        }
    }
</script>

<style scoped>

</style>